﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CaltechSoft.Service.EntityFW.Entity
{
    public class WorkOrder : BaseEntity
    {
        [Key]
        public int WorkOrderId { get; set; }
        public string WorkOrderNo { get; set; }
        public int CompanyId { get; set; }        
        public string CalibrationCycle { get; set; }
        public DateTime CalibrationDate { get; set; }
        public DateTime NextDueDate { get; set; }
        public string PONumber { get; set; }
        public string Procedure { get; set; }
        public string TechnicianId { get; set; }

        public virtual User Technician { get; set; }
        public virtual Customer Company { get; set; }

        [ForeignKey("UpdatedBy")]
        public virtual User Salesman { get; set; }

        public virtual Collection<WorkOrderDetails> WorkOrderDetails { get; set; }
    }

    public class WorkOrderDetails : Entity
    {
        public int EquipmentId { get; set; }
        public int WorkOrderId { get; set; }
        public int ServicePlace { get; set; }

        public virtual WorkOrder WorkOrder { get; set; }
        public virtual Equipment Equipment { get; set; }
    }
}
